#!/bin/bash

#set -eu

chown www:www /var/tmp/nginx
chown -R www:www /var/lib/nginx
chown -R www:www /wwwroot


/render-templates.sh /etc/nginx/sites-templates /etc/nginx/conf.d


export TIMEZONE="Asia/Shanghai"
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
echo "${TIMEZONE}" > /etc/timezone
sed -i "s|;*date.timezone =.*|date.timezone = ${TIMEZONE}|i" /etc/php7/php.ini


php-fpm7 && nginx  

exec $@
